#ifndef ABSTRACTPROBABILITYTRANSFORMER_HPP
#define ABSTRACTPROBABILITYTRANSFORMER_HPP

#include "cv.h"
#include "highgui.h"
#include "abstractFilter.hpp"

//TODO clean up includes

//FIX : big three?

class AbstractProbabilityTransformer {
public:
	
	virtual void getBackProjection( const cv::Mat& image, cv::Mat& backProjection )=0; //pure virtual function!
	
	virtual void calcAndSetHist( const cv::Mat& image )=0;
	virtual void updateHist( const cv::Mat& image, const cv::Mat& mask )=0;
	
	virtual ~AbstractProbabilityTransformer() {};
};

//FIX : big three?
//first impl decl
class PerPixelProbabilityTransformer : public AbstractProbabilityTransformer {
public:
	
	PerPixelProbabilityTransformer( cv::Ptr< AbstractFilter > filter );
								   //int* channels, const float **ranges ); //TODO delete?
	
	~PerPixelProbabilityTransformer();
	
	void getBackProjection( const cv::Mat& image, cv::Mat& backProjection );
	
	void calcAndSetHist( const cv::Mat& image );
	void updateHist( const cv::Mat& image, const cv::Mat& mask );


protected:
	cv::Ptr< AbstractFilter > filter; //TODO: As filters take almost no space, maybe don't hold pointer?
	cv::MatND* histogram;
	
	static const int arrayCount = 1; //only one array processed by back projection method
	static const double histogramScale = 1.0;
	static const bool histogramUniform = true;
	
	static const int channels[2];
	
	static const float* ranges[2];
	static float hranges[2];
	static float sranges[2];
	
	static int histSize[];
	static const int hbins = 30;
	static const int sbins = 32;

};

#endif